home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMP Graphics Collection
/
AMP Graphics Collection.iso
/
programs
/
author
/
dirwin
/
data.z
/
ANIMWIZ.DIR
/
00002_Script_Utility routines
< prev
next >
Wrap
Text File
|
1996-03-15
|
4KB
|
130 lines
on Wait nTicks
set endTime = the ticks + nTicks
repeat while the ticks < endTime
end repeat
end Wait
-- Call this for generic button handling
-- Returns TRUE if the button was pressed
-- or FALSE if the user did not release with the mouse over the button
on PressButton
set chButton = the clickOn
set castNumButtonUp = the castnum of sprite chButton
set btnUpName = the name of cast (castNumButtonUp)
set nWordsInName = the number of words in btnUpName
if nWordsInName > 1 then
if word 2 of btnUpName = "Gray" then
return FALSE -- button is gray, don't do anything
end if
end if
-- The following assumes the "down button" is one past the "up button" in cast!
-- For example, there sould be "Book" followed by "Book Down"
if nWordsInName = 1 then
set castNumButtonDown = castNumButtonUp + 1
else
set castNumBase = the number of cast(word 1 of btnUpName)
set castNumButtonDown = castNumBase + 1
end if
--StartMySound("Click")
set downFlag = TRUE
repeat while downFlag
if rollOver (chButton) then
set the castnum of sprite chButton = castNumButtonDown
else
set the castnum of sprite chButton = castNumButtonUp
end if
updateStage
set downFlag = the stillDown
end repeat
--WaitForSound()
set the castnum of sprite chButton = castNumButtonUp
updateStage
if rollover (chButton) then -- hit the button
return TRUE
else -- did not hit the button
return FALSE
end if
end PressButton
-- Call this for generic checkbox button handling
-- Returns TRUE if the user wants to reverse the state of the box
-- or FALSE if not
on PressCheckBox
set chCheckBox = the clickOn
set castNumCheckBoxUp = the castnum of sprite chCheckBox
set checkBoxUpName = the name of cast (castNumCheckBoxUp)
set nWordsInName = the number of words in checkBoxUpName
if nWordsInName > 1 then
if word 2 of checkBoxUpName = "Gray" then
return FALSE -- button is gray, don't do anything
end if
end if
-- The following assumes the "down button" is one past the "up button" in cast!
set castNumCheckBoxDown = castNumCheckBoxUp + 1
--StartMySound("Click")
set downFlag = TRUE
repeat while downFlag
if rollOver (chCheckBox) then
set the castnum of sprite chCheckBox = castNumCheckBoxDown
else
set the castnum of sprite chCheckBox = castNumCheckBoxUp
end if
updateStage
set downFlag = the stillDown
end repeat
--WaitForSound()
if rollover (chCheckBox) then -- hit the button
return TRUE
else -- did not hit the button
set the castnum of sprite chCheckBox = castNumCheckBoxUp
return FALSE
end if
end PressCheckBox
on IncrMod theCurrentValue, theMaxValue
if theCurrentValue = theMaxValue then
return 1
else
return (theCurrentValue + 1)
end if
end IncrMod
on DecrMod theCurrentValue, theMaxValue
if theCurrentValue = 1 then
return theMaxValue
else
return (theCurrentValue - 1)
end if
end DecrMod
on HitWhoH spriteNum, theMax
set theRealWidth = the right of sprite spriteNum - the left of sprite spriteNum
set who = (((the mouseH - the left of sprite spriteNum) * theMax) /¼
theRealWidth) + 1
if who <= 1 then
set who = 1
end if
if who > theMax then
set who = theMax
end if
return who
end HitWhoH
on Round n
return integer(n+0.49)
end Round